package ch05.embedded;

import ch05.embedded.ExprNode;
import ch05.Token;

/**
 * 加法操作节点
 */

public class AddNode extends ExprNode {
    ExprNode left, right;

    public AddNode(ExprNode left, Token t, ExprNode right) {
        super(t);
        this.left = left;
        this.right = right;
    }

    public void print() {
        left.print();                   // 遍历左子节点
        System.out.print("+");        // 输出操作符
        right.print();                  // 遍历右子节点
    }
}
